<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>定位 | H5笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../md/css/exercise.html" />
    
    
    <link rel="prev" href="../../md/css/flex.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="2.11"
        data-chapter-title="定位"
        data-filepath="md/css/location.md"
        data-basepath="../.."
        data-revision="Tue Mar 13 2018 17:15:57 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/html/html.html">
            
                
                    <a href="../../md/html/html.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Html知识
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/html/table.html">
            
                
                    <a href="../../md/html/table.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/html/a.html">
            
                
                    <a href="../../md/html/a.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        a标签
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="md/html/anchor.html">
            
                
                    <a href="../../md/html/anchor.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.1.</b>
                        
                        a标签锚点
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="md/html/base.html">
            
                
                    <a href="../../md/html/base.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.2.</b>
                        
                        base标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="md/html/icon.html">
            
                
                    <a href="../../md/html/icon.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.3.</b>
                        
                        icon
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/html/img.html">
            
                
                    <a href="../../md/html/img.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        图片
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="md/html/picture.html">
            
                
                    <a href="../../md/html/picture.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.1.</b>
                        
                        picture标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="md/html/hotmap.html">
            
                
                    <a href="../../md/html/hotmap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.2.</b>
                        
                        热区
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="md/html/video.html">
            
                
                    <a href="../../md/html/video.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.3.</b>
                        
                        视频
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="md/html/audio.html">
            
                
                    <a href="../../md/html/audio.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.4.</b>
                        
                        音频
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/html/tabulation.html">
            
                
                    <a href="../../md/html/tabulation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        列表
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="md/html/ul.html">
            
                
                    <a href="../../md/html/ul.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.1.</b>
                        
                        无序列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="md/html/dl.html">
            
                
                    <a href="../../md/html/dl.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.2.</b>
                        
                        无序列表2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="md/html/ol.html">
            
                
                    <a href="../../md/html/ol.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.3.</b>
                        
                        有序列表
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/html/sz.html">
            
                
                    <a href="../../md/html/sz.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        实体字符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="md/html/iframe.html">
            
                
                    <a href="../../md/html/iframe.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        iframe标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="md/html/form.html">
            
                
                    <a href="../../md/html/form.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        form表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="md/html/tz.html">
            
                
                    <a href="../../md/html/tz.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        拓展
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/css/css.html">
            
                
                    <a href="../../md/css/css.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/css/ys.html">
            
                
                    <a href="../../md/css/ys.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        元素选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/css/id-class.html">
            
                
                    <a href="../../md/css/id-class.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        id和class选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/css/relationship-selector.html">
            
                
                    <a href="../../md/css/relationship-selector.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        关系选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="md/css/w.html">
            
                
                    <a href="../../md/css/w.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        伪类选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="md/css/attribute-selectors.html">
            
                
                    <a href="../../md/css/attribute-selectors.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        属性选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="md/css/w2.html">
            
                
                    <a href="../../md/css/w2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        伪对象选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="md/css/font.html">
            
                
                    <a href="../../md/css/font.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        字体
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="md/css/color.html">
            
                
                    <a href="../../md/css/color.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        元素颜色
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="md/css/text-shadow.html">
            
                
                    <a href="../../md/css/text-shadow.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        文本阴影
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.9.1" data-path="md/css/textdecoration.html">
            
                
                    <a href="../../md/css/textdecoration.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.1.</b>
                        
                        文本的线
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9.2" data-path="md/cs/vertical-align.html">
            
            <span><b>2.9.2.</b> 文本垂直对齐</span>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="md/css/box.html">
            
                
                    <a href="../../md/css/box.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        盒子
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.10.1" data-path="md/css/zhu.html">
            
                
                    <a href="../../md/css/zhu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.1.</b>
                        
                        行内元素和块级元素
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10.2" data-path="md/css/float.html">
            
                
                    <a href="../../md/css/float.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.2.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10.3" data-path="md/css/flex.html">
            
                
                    <a href="../../md/css/flex.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.3.</b>
                        
                        弹性盒子
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="2.11" data-path="md/css/location.html">
            
                
                    <a href="../../md/css/location.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="md/css/exercise.html">
            
                
                    <a href="../../md/css/exercise.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/gitbook/use.html">
            
                
                    <a href="../../md/gitbook/use.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        gitbook使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/scss/scss.html">
            
                
                    <a href="../../md/scss/scss.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        Sass使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="md/gulp/gulp.html">
            
                
                    <a href="../../md/gulp/gulp.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Gulp
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="md/js.html">
            
            <span><b>6.</b> JS</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="md/js/js_date_obj.html">
            
                
                    <a href="../../md/js/js_date_obj.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        Date对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="md/js/理解对象.html">
            
                
                    <a href="../../md/js/理解对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        理解对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="md/js/事件.html">
            
                
                    <a href="../../md/js/事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="md/js/XMLHttpRequest对象.html">
            
                
                    <a href="../../md/js/XMLHttpRequest对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        AJAX
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >H5笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5B9A;&#x4F4D;">&#x5B9A;&#x4F4D;</h1>
<h3 id="&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;">&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;</h3>
<p><strong>&#x5F97;&#xFF1A;&#x628A;&#x5143;&#x7D20;&#x901A;&#x8FC7;&#x6309;&#x6D4F;&#x89C8;&#x5668;&#x4E0A;&#x7684;&#x4E00;&#x4E9B;&#x70B9;&#x6765;&#x628A;&#x4F4D;&#x7F6E;&#x5B9A;&#x4E0B;&#x6765;&#xFF0C;&#x4E0D;&#x4F1A;&#x53D7;&#x5176;&#x4ED6;&#x5143;&#x7D20;&#x7684;&#x5F71;&#x54CD;&#xFF1B;&#x4F46;&#x662F;&#x53EA;&#x5F53;&#x8BE5;&#x5143;&#x7D20;&#x5355;&#x4E00;&#x88AB;&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x624D;&#x662F;&#x8FD9;&#x6837;&#xFF0C;&#x5982;&#x679C;&#x7ED9;&#x8BE5;&#x5143;&#x7D20;&#x6DFB;&#x52A0;&#x4E86;&#x7236;&#x7C7B;&#x5143;&#x7D20;&#xFF0C;&#x7ED9;&#x7236;&#x7C7B;&#x5143;&#x7D20;&#x52A0;&#x4E0A;&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x63A7;&#x5236;&#x8BE5;&#xFF08;&#x88AB;&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;&#xFF09;&#x5143;&#x7D20;;&#x5F53;&#x9700;&#x8981;&#x63A7;&#x5236;&#x67D0;&#x4E9B;&#x5143;&#x7D20;&#x5728;&#x4E00;&#x4E2A;&#x4F4D;&#x7F6E;&#x4E0A;&#x4E0D;&#x53D7;&#x5F71;&#x54CD;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x7236;&#x5143;&#x7D20;&#xFF08;&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;&#xFF09;&#x6765;&#x63A7;&#x5236;&#x6574;&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x7EDD;&#x5BF9;&#x4F4D;&#x7F6E;</strong></p>
<p>&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;</p>
<p>&#x628A;&#x5143;&#x7D20;&#x8131;&#x79BB;&#x6587;&#x6863;&#x6D41;&#xFF0C;&#x901A;&#x8FC7;<code>left</code>,<code>right</code>,<code>top</code>,<code>bottom</code>&#x8FDB;&#x884C;&#x5B9A;&#x4F4D;&#xFF0C;&#x53C2;&#x8003;&#x70B9;&#x662F;<code>body</code>&#x7684;&#x6700;&#x5DE6;&#x4E0A;&#x89D2;(0.0)</p>
<p>&#x7279;&#x70B9;&#xFF1A;</p>
<ol>
<li>&#x8131;&#x79BB;&#x6587;&#x6863;&#x6D41;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x518D;&#x5360;&#x7528;&#x6B63;&#x5E38;&#x6587;&#x6863;&#x6D41;&#x7684;&#x4F4D;&#x7F6E;</li>
<li>&#x975E;&#x5E38;&#x7684;&#x81EA;&#x7531;&#xFF0C;&#x53EF;&#x4EE5;&#x968F;&#x610F;&#x65B9;&#x4FBF;&#x7684;&#x8BBE;&#x7F6E;&#x4F4D;&#x7F6E;&#x4FE1;&#x606F;&#xFF0C;&#x901A;&#x5E38;&#x63A8;&#x8350;&#x56DB;&#x4E2A;&#x65B9;&#x5411;&#x7684;2&#x4E2A;&#x5C31;&#x884C;&#x4E86;</li>
<li>&#x4E0D;&#x5BB9;&#x6613;&#x53D7;&#x63A7;&#xFF0C;&#x4E0D;&#x53D7;&#x5143;&#x7D20;&#x7ED3;&#x6784;&#x7684;&#x5F71;&#x54CD;&#xFF0C;&#x57FA;&#x672C;&#x5C31;&#x662F;&#x6839;&#x636E;body&#x5DE6;&#x4E0A;&#x89D2;&#x4F5C;&#x4E3A;&#x53C2;&#x8003;&#x70B9;&#xFF1B;&#x5982;&#x679C;&#x7236;&#x5143;&#x7D20;&#x6CA1;&#x6709;&#x53C2;&#x8003;&#x4FE1;&#x606F;&#xFF0C;&#x5219;&#x4EE5;body&#x7684;&#x5750;&#x4E0A;&#x89D2;&#x4F5C;&#x4E3A;&#x53C2;&#x8003;&#x70B9;&#xFF0C;&#x5426;&#x5219;&#xFF0C;&#x5219;&#x4EE5;&#x7236;&#x5143;&#x7D20;&#x7684;&#x5DE6;&#x4E0A;&#x89D2;&#x4F5C;&#x4E3A;&#x53C2;&#x8003;&#x70B9;&#xFF08;&#x5E26;&#x6709;&#x5B9A;&#x4F4D;&#x4FE1;&#x606F;&#x7684;&#x5143;&#x7D20;&#xFF0C;&#x662F;&#x6307;&#x8BBE;&#x7F6E;&#x4E86;&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;&#x3001;&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;&#x3001;&#x56FA;&#x5B9A;&#x5B9A;&#x4F4D;&#x7684;&#x5143;&#x7D20;&#xFF0C;&#x4F46;&#x6211;&#x4EEC;&#x66F4;&#x63A8;&#x8350;&#x4F7F;&#x7528;&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;&#x6765;&#x7BA1;&#x7406;&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;&#x7684;&#x5143;&#x7D20;&#xFF09;</li>
</ol>
<pre><code class="lang-css">    &lt;html&gt;
        &lt;head&gt;
            &lt;meta charset=&quot;UTF-8&quot;&gt;
            &lt;title&gt;&lt;/title&gt;
            &lt;style type=&quot;text/css&quot;&gt;
                .test{
                    height: 100px;
                    width: 100px;
                    background: skyblue;
                    position: absolute;  /*&#x8BBE;&#x7F6E;&#x5B9A;&#x4F4D;&#x4FE1;&#x606F;&#x4E3A;&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;*/
                    left: 100px;
                    right: &#xFF08;&#x53C2;&#x6570;&#xFF09;;
                    top: &#xFF08;&#x53C2;&#x6570;&#xFF09;;
                    bottom: 100px;
                }
                .test2{
                    height: 100px;
                    width: 100px;
                    background: pink;
                }
                .baba{

                }
            &lt;/style&gt;
        &lt;/head&gt;
        &lt;body&gt;
            &lt;div class=&quot;baba&quot;&gt;
                &lt;div class=&quot;test&quot;&gt;
                    &#x4E00;&#x5339;&#x91CE;&#x9A6C;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;test2&quot;&gt;
                &#x7F8A;
            &lt;/div&gt;
        &lt;/body&gt;
    &lt;/html&gt;
</code></pre>
<h3 id="&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;">&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;</h3>
<p><strong>&#x5F97;&#xFF1A;&#x6BD4;&#x8F83;&#x53EF;&#x63A7;&#x5236;&#x7684;&#x5B9A;&#x4F4D;&#x65B9;&#x5F0F;&#xFF0C;&#x901A;&#x5E38;&#x7528;&#x6765;&#x548C;&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;&#x4F7F;&#x7528;&#xFF0C;&#x7528;&#x6765;&#x63A7;&#x5236;&#x4F4F;&#x5B83;</strong></p>
<p>&#x901A;&#x5E38;&#x7528;&#x6765;&#x63A7;&#x5236;&#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;&#x7684;&#x5143;&#x7D20;</p>
<p>&#x7279;&#x70B9;&#xFF1A;</p>
<ol>
<li>&#x5E76;&#x6CA1;&#x6709;&#x8131;&#x79BB;&#x6587;&#x6863;&#x6D41;&#xFF0C;&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;&#x662F;&#x6307;&#x76F8;&#x5BF9;&#x4E8E;&#x8FD9;&#x4E2A;&#x5143;&#x7D20;&#x672C;&#x8EAB;&#x6240;&#x5728;&#x6587;&#x6863;&#x6D41;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x8FDB;&#x884C;&#x504F;&#x79FB;&#xFF08;&#x6240;&#x4EE5;&#x53C2;&#x8003;&#x70B9;&#x662F;&#x5B83;&#x81EA;&#x5DF1;&#x539F;&#x672C;&#x7684;&#x5750;&#x4E0A;&#x89D2;&#xFF09;</li>
<li>&#x6B63;&#x5E38;&#x4F7F;&#x7528;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x901A;&#x5E38;&#x4E0D;&#x4F1A;&#x7528;<code>left</code>&#x7B49;&#x503C;&#xFF0C;&#x53BB;&#x6539;&#x53D8;&#x4ED6;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x8FD9;&#x6837;&#x4E0D;&#x5229;&#x4E8E;&#x6211;&#x4EEC;&#x7684;&#x5E03;&#x5C40;</li>
</ol>
<pre><code class="lang-css">&lt;style type=&quot;text/css&quot;&gt;
.baba{
                width: 300px;
                height: 300px;
                background: black;
                position: relative;
                left: 100px;
                top: 100px;
            }
            .son{
                width: 100px;
                height: 100px;
                background: red;
                position: absolute;//&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;
                left: 30px;
                top: 30px;
            }
        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div class=&quot;baba&quot;&gt;
            &lt;div class=&quot;son&quot;&gt;

            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/body&gt;
</code></pre>
<h3 id="&#x56FA;&#x5B9A;&#x5B9A;&#x4F4D;">&#x56FA;&#x5B9A;&#x5B9A;&#x4F4D;</h3>
<p><strong>&#x5F97;&#xFF1A;&#x5C31;&#x662F;&#x628A;&#x5143;&#x7D20;&#x56FA;&#x5B9A;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x4E00;&#x4E2A;&#x4F4D;&#x7F6E;&#xFF0C;&#x4E0D;&#x4F1A;&#x53D7;&#x9875;&#x9762;&#x5185;&#x90E8;&#x7684;&#x5143;&#x7D20;&#x5F71;&#x54CD;&#xFF0C;&#x5C31;&#x50CF;&#x4E00;&#x4E9B;&#x7F51;&#x9875;&#x5F39;&#x7A97;&#xFF0C;&#x90E8;&#x5206;&#x662F;&#x7528;&#x56FA;&#x5B9A;&#x5B9A;&#x4F4D;&#x6765;&#x505A;&#x7684;</strong></p>
<p>&#x7279;&#x70B9;&#xFF1A;</p>
<ol>
<li>&#x6C38;&#x8FDC;&#x53C2;&#x8003;&#x7A97;&#x53E3;&#x7684;&#x5DE6;&#x4E0A;&#x89D2;&#x4F5C;&#x4E3A;&#x57FA;&#x51C6;&#x70B9;&#xFF0C;&#x4E0D;&#x53D7;&#x4EFB;&#x4F55;&#x7236;&#x5143;&#x7D20;&#x7684;&#x63A7;&#x5236;</li>
<li>&#x901A;&#x5E38;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x56FA;&#x5B9A;&#x67D0;&#x4E9B;&#x5143;&#x7D20;&#x5728;&#x6211;&#x4EEC;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x7A97;&#x53E3;&#x4E0A;</li>
</ol>
<pre><code class="lang-css">&lt;style type=&quot;text/css&quot;&gt;
            .ad{
                position: fixed;
                right: 0;
                bottom: 0;
            }
            body{
                height: 9999px; /*&#x7528;&#x4E8E;&#x6D4B;&#x8BD5;*/
            }
        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div class=&quot;ad&quot;&gt;
            &lt;img src=&quot;img/T6.png&quot;/&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD
</code></pre>
<h3 id="&#x5B9A;&#x4F4D;&#x7684;&#x4E00;&#x4E9B;&#x5E94;&#x7528;">&#x5B9A;&#x4F4D;&#x7684;&#x4E00;&#x4E9B;&#x5E94;&#x7528;</h3>
<p>&#x793A;&#x4F8B;&#x4EE3;&#x7801;</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-title">html</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">head</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">meta</span> <span class="hljs-attribute">charset</span>=<span class="hljs-value">&quot;UTF-8&quot;</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">title</span>&gt;</span>&#x5B9A;&#x4F4D;&#x9AD8;&#x7EA7;&#x8FD0;&#x7528;<span class="hljs-tag">&lt;/<span class="hljs-title">title</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-title">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">body</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">style</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/css&quot;</span>&gt;</span><span class="css">
        *<span class="hljs-rules">{
            <span class="hljs-rule"><span class="hljs-attribute">margin</span>:<span class="hljs-value"> <span class="hljs-number">0</span></span></span>;
        }</span>
            <span class="hljs-class">.bb</span><span class="hljs-rules">{
                <span class="hljs-rule"><span class="hljs-attribute">width</span>:<span class="hljs-value"> <span class="hljs-number">1000px</span></span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">height</span>:<span class="hljs-value"> <span class="hljs-number">600px</span></span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">position</span>:<span class="hljs-value"> relative</span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">background</span>:<span class="hljs-value"> skyblue</span></span>;
            }</span>
            <span class="hljs-class">.son</span><span class="hljs-rules">{
                <span class="hljs-rule"><span class="hljs-attribute">width</span>:<span class="hljs-value"> <span class="hljs-number">100px</span></span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">height</span>:<span class="hljs-value"> <span class="hljs-number">100px</span></span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">background</span>:<span class="hljs-value"> white</span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">position</span>:<span class="hljs-value"> absolute</span></span>;
                <span class="hljs-comment">/*
                 1.&#x6C34;&#x5E73;&#x5BF9;&#x9F50;
                 &#x7F3A;&#x70B9;&#xFF1A;&#x5B50;&#x5143;&#x7D20;&#x7684;&#x5BBD;&#x5EA6;&#x5FC5;&#x987B;&#x56FA;&#x5B9A;
                 * */</span>
                <span class="hljs-rule"><span class="hljs-attribute">left</span>:<span class="hljs-value"> <span class="hljs-number">50%</span></span></span>;     <span class="hljs-comment">/*&#x57FA;&#x4E8E;&#x7236;&#x5143;&#x7D20;&#x7684;&#x5BBD;&#x5EA6;&#x7684;&#x767E;&#x5206;&#x4E4B;50&#x504F;&#x79FB;*/</span> 
                <span class="hljs-rule"><span class="hljs-attribute">margin</span>:<span class="hljs-value"> -<span class="hljs-number">50px</span></span></span>;
                <span class="hljs-comment">/*top: 50%;*/</span>

                <span class="hljs-rule"><span class="hljs-attribute">left</span>:<span class="hljs-value"> <span class="hljs-number">0</span></span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">right</span>:<span class="hljs-value"> <span class="hljs-number">0</span></span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">margin-left</span>:<span class="hljs-value"> auto</span></span>;
                <span class="hljs-rule"><span class="hljs-attribute">margin-right</span>:<span class="hljs-value"> auto</span></span>;

                <span class="hljs-comment">/*position: absolute;
                 * left: -999px;
                right: -999px;
                top: -999px;
                bottom: -999px;
                margin: auto;*/</span>
            }</span>
        </span><span class="hljs-tag">&lt;/<span class="hljs-title">style</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">&quot;&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;bb&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;son&quot;</span>&gt;</span>

            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-title">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">html</span>&gt;</span>
</code></pre>
<p><em>&#x5B8C;&#x5168;&#x4E0A;&#x4E0B;&#x5DE6;&#x53F3;&#x5C45;&#x4E2D;</em></p>
<p>&#x4E0D;&#x6539;&#x53D8;&#x56FE;&#x7247;&#x5927;&#x5C0F;&#xFF0C;&#x8BA9;&#x56FE;&#x7247;&#x5C45;&#x4E2D;&#x5728;&#x7A97;&#x53E3;&#x4E2D;&#x95F4;</p>
<pre><code class="lang-css">    <span class="hljs-rule"><span class="hljs-attribute">position</span>:<span class="hljs-value"> absolute</span></span>;
    <span class="hljs-rule"><span class="hljs-attribute">left</span>:<span class="hljs-value"> -<span class="hljs-number">999px</span></span></span>;
    <span class="hljs-rule"><span class="hljs-attribute">right</span>:<span class="hljs-value"> -<span class="hljs-number">999px</span></span></span>;
    <span class="hljs-rule"><span class="hljs-attribute">top</span>:<span class="hljs-value"> -<span class="hljs-number">999px</span></span></span>;
    <span class="hljs-rule"><span class="hljs-attribute">bottom</span>:<span class="hljs-value"> -<span class="hljs-number">999px</span></span></span>;
    <span class="hljs-rule"><span class="hljs-attribute">margin</span>:<span class="hljs-value"> auto</span></span>;
</code></pre>
<p><em>&#x5DE6;&#x53F3;&#x5B8C;&#x5168;&#x5C45;&#x4E2D;</em></p>
<pre><code class="lang-css">    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
=======
&gt;&gt;&gt;&gt;&gt;&gt;&gt; 92e5528e86141eb101eba32a173874dedda4be0a
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../md/css/flex.html" class="navigation navigation-prev " aria-label="Previous page: 弹性盒子"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../md/css/exercise.html" class="navigation navigation-next " aria-label="Next page: 练习"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"expandable-chapters":{},"redirect":{},"splitter":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
